import { request } from '@/framework/utils/request-jdz';
import _ from 'lodash-es';
// 查询盒子
export const getBox = (queryParam, queryOpt) => {
  let searchData = _.pickBy({ ...queryParam, ...queryOpt });
  return request(
    {
      url: '/storage/box/instance/inable',
      method: 'get',
      params: searchData,
    },
    {
      isGetDataDirectly: false,
    },
  );
};
// 查询样本
export const singleSearch = (queryParam, queryOpt) => {
  let searchData = _.pickBy({ ...queryParam, ...queryOpt });
  return request(
    {
      url: '/strain/instance/stock',
      method: 'get',
      params: searchData,
    },
    {
      isGetDataDirectly: false,
    },
  );
};
// 获取入库单号
export const getBillno = () => {
  return request(
    {
      url: '/bill-in/generate/batch-no',
      method: 'get',
    },
    {
      isGetDataDirectly: false,
    },
  );
};
// 入库单提交
export const billIn = (data) => {
  return request(
    {
      url: '/bill-in',
      method: 'post',
      data: data,
    },
    {
      isGetDataDirectly: false,
    },
  );
};
// 获取入库单记录
export const inputSearch = (params) => {
  return request(
    {
      url: '/bill-in',
      method: 'get',
      params,
    },
    {
      isGetDataDirectly: false,
    },
  );
};
// 入库核查提交
export const inputUpdate = (data) => {
  return request(
    {
      url: '/bill-in',
      method: 'patch',
      data: data,
    },
    {
      isGetDataDirectly: false,
    },
  );
};
// 入库单删除
export const DELETEinputUp = (id) => {
  return request(
    {
      url: `/bill-in/${id}`,
      method: 'DELETE',
    },
    {
      isGetDataDirectly: false,
    },
  );
};
// 获取存储位置信息
export const storageTree = () => {
  return request(
    {
      url: '/storages/tree',
      method: 'get',
    },
    {
      isGetDataDirectly: false,
    },
  );
};
// 获取盒子详情
export const aloneStrictMode = (id) => {
  return request(
    {
      url: `/stock/${id}/detail`,
      method: 'get',
    },
    {
      isGetDataDirectly: false,
    },
  );
};
// 获取入库单详情
export const inputGetById = (id) => {
  return request(
    {
      url: '/bill-in/' + id + '/detail',
      method: 'get',
    },
    {
      isGetDataDirectly: false,
    },
  );
};
//底单存档修改记录提交
export const explain = (data) => {
  return request(
    {
      url: '/bill/modify/history/insert/',
      method: 'post',
      data,
    },
    {
      isGetDataDirectly: false,
    },
  );
};
//请求基点出入库任务
export const getBasicPointList = (params) => {
  return request(
    {
      url: `task/billStatus`,
      method: 'get',
      params,
    },
    {
      isGetDataDirectly: false,
    },
  );
};
//基点失败重试
export const billInPutin = (id, data) => {
  return request(
    {
      url: '/bill-in/' + id + '/putin',
      method: 'post',
      data,
    },
    {
      isGetDataDirectly: false,
    },
  );
};
//基点失败忽略
export const billInIgnore = (id, data) => {
  return request(
    {
      url: '/bill-in/' + id + '/ignore',
      method: 'post',
      data,
    },
    {
      isGetDataDirectly: false,
    },
  );
};
